package example.steps;

import net.thucydides.core.annotations.Step;
import net.thucydides.core.steps.ScenarioSteps;

import org.junit.Assert;

import example.pages.HomePage;
import example.pages.IndexPage;

public class LoginSteps extends ScenarioSteps
{
	IndexPage indexPage;
	HomePage homePage;

	@Step("Go to Index page")
	public void go_to_index_page()
	{
		indexPage.open();
	}

	@Step("Type a login")
	public void type_login(String login)
	{
		indexPage.type_login(login);
	}

	@Step("Type a password")
	public void type_password(String pass)
	{
		indexPage.type_password(pass);
	}

	@Step("Try to login")
	public void try_login()
	{
		indexPage.send_login_data();
	}

	@Step("Logout by user menu")
	public void logout_by_user_menu()
	{
		homePage.logout();
	}

	@Step("Check for user is on Home page")
	public void should_be_home_page()
	{
		Assert.assertTrue(homePage.is_user_menu_present());
	}

	@Step("Check for user is on Index page")
	public void should_be_index_page()
	{
		Assert.assertTrue(indexPage.is_index_page());
	}

}